<template>
	<view style="background-color: #f1f1f1;height: 100vh;">
		<A-header :baseInfo="baseInfo"></A-header>
		<!-- <A-hotdot></A-hotdot> -->
		<A-btnbar :baseInfo="baseInfo"></A-btnbar>
	</view>
</template>

<script>
	import {
		getIndex
	} from '@/api/billboard.js'
	import AHeader from './subpages/header.vue'
	import AHotdot from './subpages/hotdot.vue'
	import ABtnbar from './subpages/btnbar.vue'

	export default {
		components: {
			AHeader,
			AHotdot,
			ABtnbar
		},
		data() {
			return {
				baseInfo: {}
			}
		},
		onShow() {
			this.getIndex()
		},
		mounted() {
			this.getIndex()
		},
		onReady() {

		},
		onShareAppMessage() {
			return this.getShareData()
		},
		// 转发至朋友圈
		onShareTimeline() {
			return this.getShareData("timeline")
		},
		methods: {
			// 获取分享信息
			getShareData(type) {
				let title = "帮扶乡村学童，助力乡村振兴，领取爱心荣誉证书";
				let path = "pages/billboard/index";
				let imageUrl = "../../static/share.png";
				if (type == "timeline") {
					return {
						title,
						imageUrl,
						query: path
					};
				}
				return {
					title,
					imageUrl,
					path
				};
			},
			getIndex() {
				uni.showLoading({
					title: '数据加载中...',
					mask: true
				});
				getIndex().then(res => {
					if (res.code == 200) {
						this.baseInfo = res.data
						uni.hideLoading();
					} else {
						uni.showToast({
							title: '获取数据失败！',
							duration: 1000,
							icon: 'none',
						});
					}
				})
			}
		}
	}
</script>

<style scoped>



</style>
